import { defineComponent, h, PropType } from 'vue'
import { useI18n } from 'vue-i18n'

export default defineComponent({
  props: {
    i18nLanguage: {
      type: String,
      default: '',
    },
    callBack: {
      type: Function as PropType<() => void>,
      default: () => {},
    },
  },
  setup(props, { emit, slots }) {
    const { t } = useI18n()

    return () =>
      h(
        'div',
        {
          class:
            'p-3 flex items-center justify-between space-x-2 cursor-pointer h-7',
          onClick() {
            props.callBack()
          },
        },
        [
          slots?.default?.(),
          h(
            'div',
            { class: 'flex items-center justify-start w-full' },
            t(props.i18nLanguage)
          ),
        ]
      )
  },
})
